﻿using System.Linq;
using JetBrains.Annotations;
using Missbot.AIModule.Gaming.Shopping;
using Missbot.AIModule.OnlineStore;
using Missbot.Core.Base;

namespace Missbot.AIModule.Vip.VipArmers
{
    [UsedImplicitly]
    public class 星耀之匣 : IVipArmer
    {
        public string Name { get; set; } = "星耀之匣";
        public string Description { get; set; } = "获取稀有商店中的所有物品，每周限购一次。";
        public int DiamondsNeed { get; set; } = 800;
        public VipArmerLimitInterval LimitInterval { get; set; } = VipArmerLimitInterval.Weekly;
        public int LimitCount { get; set; } = 1;

        public bool Purchase(InboxSession session)
        {
            var todayRec = DailySellItemRareDA.GetToday();
            if (!todayRec.IsActive)
            {
                session.SendBack("稀有商店尚未开启，你无法购买此物品！");
                return false;
            }

            var itemColle = ItemCollectionDA.Get(session.User.ID);
            var msgs = todayRec.Items.Select(item => itemColle.ItemIncome(item.Name));
            session.SendBack(string.Join("\n", msgs));
            return true;
        }

        public int MaxContains { get; set; }
    }
}